package com.atguigu.gmall0701.demo.customer.service.impl;

import com.atguigu.gmall0701.demo.customer.bean.Customer;
import com.atguigu.gmall0701.demo.customer.service.CustomerService;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;


@Service("CustomerServiceA") //把该实现类 注册成一个组件 ，这个组件常驻内存 而且 默认为单态
public class CustomerServiceImpl implements CustomerService {


    @Override
    public Customer getCustomerById(String id) {
        return new Customer("123","zhang3",99);
    }

    @Override
    public List<Customer> getCustomerList(String name, Integer age) {
        List<Customer> customerList =new ArrayList<>();
        customerList.add(new Customer("123","zhang3",99));
        customerList.add(new Customer("456","li4",88));
        String abc=null;
        System.out.println(abc.toString());
        return customerList;
    }

    @Override
    public void saveCustomer(Customer customer) {
        System.out.println("保存客户信息："+customer.toString());
    }
}
